<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>京东tab栏</title>
</head>
<style>
    *{
        text-decoration: none;
        list-style: none;
        color:#000;
    }
    ul{
        border-bottom: 5px solid rgb(88, 32, 32);
        height:70px;
    }
    .box{
        height:70px;
        width:150px;
        line-height: 70px;
        text-align: center;
        float: left;
        font-size: 20px;
        font-weight: bold;
        color:#000;
    }
    .active{
        background-color: red;
    }
    .activeToA{
        color:#fff;
    }

</style>
<body>
    <div id="app">
        <ul >
            <li @click="activeIndexChange(index)" class="box" :class="{active:index == activeIndex}" v-for="(item , index) in list" :key="item.id">
                <a :class="{activeToA:index == activeIndex}" href="#">{{item.name}}</a>
            </li>
        </ul>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
<script>
    const app = new Vue({
        el:'#app',
        data:{
            activeIndex:0,
            list:[
                {id:1 , name:"京东秒杀"},
                {id:2 , name:"每日特价"},
                {id:3 , name:"品类秒杀"}
            ]
        },
        methods:{
            activeIndexChange(index){
                this.activeIndex = index ;
            }
        }
    })
</script>
</html>